package 动态链表.测试;

import 动态链表.LinkedSinglyList;

import java.util.Comparator;

public class TestLinkedSinglyList {
    public static void main(String[] args) {
        LinkedSinglyList<Integer> list = new LinkedSinglyList<>();
        System.out.println(list);
        for (int i = 1; i <= 5; i++) {
            list.add(i);
        }
        System.out.println(list);
        list.add(3,6);
        System.out.println(list);
        System.out.println(list.remove(3));
        System.out.println(list);
        System.out.println(list.set(3,10));
        System.out.println(list);
        System.out.println(list.subList(1,4));
        for (int i = 1; i <= 5; i++) {
            list.add((int) (Math.random() * 10));
        }
        System.out.println(list);
        list.sort(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o1 - o2;
            }
        });
        System.out.println(list);
    }
}
